<header id="topbar" class="">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#stats/recharge_order/">充值订单查询</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <a href="#" class="btn btn-default btn-sm light fw600 ml10" id="exportData"><span class="glyphicon glyphicon-cloud-download pr5"></span>导出数据</a>
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <% if(items.length>0){ %>
    <div class="panel overflow">
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <th class="sortable" data-field="id">ID</th>
                    <th>支付状态</th>
                    <th class="sortable" data-field="created_at">下单时间</th>
                    <th class="sortable" data-field="updated_at">更新(到账)时间</th>
                    <th>用户ID</th>
                    <th>用户类型</th>
                    <th>充值类型</th>
                    <th class="sortable" data-field="price">充值金额</th>
                    <th>来源</th>
                    <th class="">充值入口</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){ %>
                    <tr data-id="<%= item.id %>" >
                        <td class=""><a class="modify-item"><%= item.id %></a></td>
                        <td class=""><%= PAY_STATUS[item.status] %></td>
                        <td class=""><%= item.created_at %></td>
                        <td class=""><%= item.updated_at %></td>
                        <td class=""><a href="#stats/account/?id=<%= item.user_id %>"><%= item.user_id %><a></td>
                        <td class=""><%= USER_TYPE[item.user_type] || "(账户丢失)"%></td>
                        <td class=""> <%= window.PAY_TYPE[item.pay_type] || "(未知)"%></td>
                        <td class=""><%= item.price %>
                        <td class=""><%= window.PAY_CREATED_BY[item.created_by] || "(未知)"%></td>
                        <td class=""><%= item.activity_name || '-' %></td>
                    </tr>
                <%
                }) %>
            </tbody>
        </table>
    </div>

    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
    <% }else{ %>
    <h4 class="text-muted">请通过用户ID查询</h4>
    <% } %>
</section>


<!-- Panel popup -->
<div id="editWithdrawPanel" class="popup-basic popup-lg bg-none mfp-with-anim mfp-hide">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-pencil"></i></span>
            <span class="panel-title">订单详情</span>
        </div>
        <div class="panel-body">
            <form id="behavior-form" class="form-horizontal" role="form">
            <div class="form-group">
                <label for="order_id" class="col-md-3 control-label">订单id：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="order_id">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="pay_status" class="col-md-3 control-label">支付状态：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="pay_status">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="created_at" class="col-md-3 control-label">下单时间：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="created_at">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="updated_at" class="col-md-3 control-label">更新(到账)时间：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="updated_at">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="user_id" class="col-md-3 control-label">用户ID：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="user_id">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="user_type" class="col-md-3 control-label">用户类型：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="user_type">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="recharge_type" class="col-md-3 control-label">充值类型：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-danger" id="recharge_type">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="recharge_price" class="col-md-3 control-label">充值金额：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-danger" id="recharge_price">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="recharge_ent" class="col-md-3 control-label">充值入口：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="recharge_ent">
                  </p>
                </div>
            </div>
            </form>
        </div>
        <div class="panel-footer text-right">
            <button class="btn btn-primary" type="button" id="submitClose">关闭</button>
        </div>
    </div>
</div>


<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano">
 <div class="sidebar_right_content nano-content">
     <div class="tab-block sidebar-block br-n">
        <ul class="nav nav-tabs tabs-border nav-justified">
            <li class="active">
                <a href="#sidebar-right-tab1" data-toggle="tab">统计数据</a>
            </li>
            <li>
                <a href="#sidebar-right-tab2" data-toggle="tab">过滤搜索</a>
            </li>
        </ul>
        <div class="tab-content br-n">
            <div id="sidebar-right-tab1" class="tab-pane active">
                <div class="p20 admin-form">
                    <% var total = 0,
                        count = 0;
                    _.each(overview, function(obj){
                    total += obj.total;
                    count += obj.count;
                    %>
                        <h5 class="title-divider text-muted mb20"><%= PAY_TYPE[obj.pay_type] %>（<%= PAY_CREATED_BY[obj.created_by] %>）<span class="pull-right"> <%= obj.total %>/<%= obj.count %>次 </span> </h5>
                    <%})
                    if(null != overview){
                    if(overview.length > 1){%>
                        <h5 class="title-divider text-muted mb20">总计<span class="pull-right"> <%= total.toFixed(2) %>/<%= count %>次 </span> </h5>
                    <% }else if(overview.length == 0){ %>
                        <h5 class="text-muted mb20">无数据...</h5>
                    <% }} %>
                </div>
            </div>
            <div id="sidebar-right-tab2" class="tab-pane">
                <div class="p20 admin-form">
                    <h6 class="fw400">支付状态</h6>
                    <div class="section mb15">
                        <label class="field select">
                            <select id="searchStatus" name="searchStatus" data-field="status">
                                <option value="2" <%= searched.status == 2 ? 'selected' : '' %>>已支付</option>
                                <option value="1" <%= searched.status == 1 ? 'selected' : '' %>>未支付</option>
                                <option value="4" <%= searched.status == 4 ? 'selected' : '' %>>支付失败</option>
                                <option value="0" <%= searched.status == 0 ? 'selected' : '' %>>全部</option>
                            </select>
                            <i class="arrow double"></i>
                        </label>
                    </div>
                    <div class="section mb15">
                        <label for="searchId" class="field prepend-icon">
                            <input title="ID" type="text" data-field="user_id" id="searchId" class="gui-input" placeholder="ID" value="<%= searched.id  %>">
                            <label for="searchId" class="field-icon"><i class="fa fa-tag"></i>
                            </label>
                        </label>
                    </div>
                    <div class="section mb15">
                        <label for="searchUserId" class="field prepend-icon">
                            <input title="用户ID" type="text" data-field="user_id" id="searchUserId" class="gui-input" placeholder="用户ID" value="<%= searched.user_id  %>">
                            <label for="searchUserId" class="field-icon"><i class="fa fa-tag"></i>
                            </label>
                        </label>
                    </div>
                    <h6 class="fw400">充值时间</h6>
                    <div class="section row">
                        <div class="col-md-6">
                                <input type="text" title="下限，包含当天" name="searchCreatedAtLower" id="searchCreatedAtLower" class="gui-input" data-type="date" value="<%= searched.created_at_lower %>" placeholder=">=">
                                </label>
                            </label>
                        </div>
                        <div class="col-md-6">
                                <input type="text" title="上限，不包括当天" name="searchCreatedAtUpper" id="searchCreatedAtUpper" class="gui-input" data-type="date" value="<%= searched.created_at_upper %>" placeholder="<">
                                </label>
                            </label>
                        </div>
                    </div>
                    <h6 class="fw400">付费入口</h6>
                    <div class="section mb15">
                        <label class="field select">
                            <select id="searchType" name="searchType" data-field="type">
                                <option value="-1" <%= searched.type == -1 ? 'selected' : '' %>>所有</option>
                                <option value="0" <%= searched.type == 0 ? 'selected' : '' %>>仅充值</option>
                                <option value="1" <%= searched.type == 1 ? 'selected' : '' %>>充值并购买</option>
                            </select>
                            <i class="arrow double"></i>
                        </label>
                    </div>
                    <h6 class="fw400">充值方式</h6>
                    <div class="section mb15">
                        <label class="field select">
                            <select id="searchPayType" name="searchPayType" data-field="pay_type">
                                <option value="-1" <%= searched.pay_type == -1 ? 'selected' : '' %>>所有</option>
                                <% _.each(PAY_TYPE, function(v, k){%>
                                    <option value="<%= k %>" searched.pay_type == k ? 'selected': 0><%= v %></option>
                                <% }) %>
                            </select>
                            <i class="arrow double"></i>
                        </label>
                    </div>
                    <h6 class="fw400">用户类型</h6>
                    <div class="section mb15">
                        <label class="field select">
                            <select id="searchUserType" name="searchUserType" data-field="user_type">
                                <option value="-1" <%= searched.user_type == -1 ? 'selected' : '' %>>所有</option>
                                <% _.each(USER_TYPE, function(v, k){%>
                                    <option value="<%= k %>" searched.user_type == k ? 'selected': 0><%= v %></option>
                                <% }) %>
                            </select>
                            <i class="arrow double"></i>
                        </label>
                    </div>
                    <hr class="short">

                    <button class="btn btn-default btn-block" type="button" id="search">搜索</button>

                </div>
            </div>
        </div>
     </div>
 </div>

</aside>
<!-- End: Right Sidebar -->
